<div class="main-content">
    <div class="section__content section__content--p20">
        <div class="container-fluid">
            <div class="row m-b-30">
                <div class="col-lg-12">
                    <div class="overview-wrap">
                        <h2 class="title-1">编辑语言：<?php echo $lang['name']; ?></h2>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <strong>编辑语言：<?php echo $lang['name']; ?></strong>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive table--no-card m-b-30">
                                <table class="table table-borderless table-striped table-earning">
                                    <thead>
                                    <tr>
                                        <th>分类</th>
                                        <th>描述</th>
                                        <th>翻译</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                    if (sizeof($langs) > 0) {
                                        foreach ($langs as $l) {
                                            ?>
                                            <tr>
                                                <td><label class="control-label"><?php echo $l['category']; ?></label></td>
                                                <td><label class="control-label"><?php echo $l['message']; ?></label></td>
                                                <td>
                                                    <input value="<?php echo $l['translation']; ?>" type="text" class="form-control" onchange="updateTranslation(<?php echo $l['id']; ?>,this.value)">
                                                </td>
                                            </tr>
                                            <?php
                                        }
                                    }
                                    ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var lang = '<?php echo $lang['lang']; ?>';
    function updateTranslation(id,val) {
        $.get('index.php?r=admin/language/updatetransaction',{
            'id':id,
            'val':val,
            'lang':lang
        },function (res) {
            if(message(res)){

            }
        },'json');
    }
</script>